package environment;

public class Capabilities {
	
	private boolean maxPayload;
	private boolean mobility;
	private boolean arm;
	private boolean gripper;
	private boolean sensors;
	
	private String state = "Wandering";
	
	/**
	 * Default Capabilites class
	 * @param push - able to push
	 * @param cam - does it have a camera
	 * @param arm - does it have a robotic arm
	 * @param bump - does it have a bumper(?)
	 */
	public Capabilities()
	{
		this.maxPayload = false;
		this.mobility = false;
		this.arm = false;
		this.sensors = false;
		this.gripper = false;
	}
	
	/**
	 * Capabilites class responsible for
	 * encapsulating all the capabilities
	 * of the object
	 * @param push - able to push
	 * @param cam - does it have a camera
	 * @param arm - does it have a robotic arm
	 * @param bump - does it have a bumper(?)
	 */
	public Capabilities(boolean maxPayload, boolean arm, boolean mobility, boolean sensors, boolean gripper)
	{
		this.maxPayload = maxPayload;
		this.mobility = mobility;
		this.arm = arm;
		this.sensors = sensors;
		this.gripper = gripper;
	}
	
	/**
	 * Contains method to check if owner is capable
	 * @param other - capabilites of other object
	 * @return true if owner of this class is capable of pushing the other object
	 * 		   false if owner is not capable
	 */
	public boolean contains(Capabilities other)
	{
		boolean[] other_cap = other.toArray();
		boolean[] my_cap = toArray();
		
		for(int i = 0; i < 4; i++ )
		{
			if(other_cap[i] && !my_cap[i]) return false;
		}
		
		return true;		
	}
	
	/**
	 * private helper method to
	 * get all the capabilites in
	 * array form
	 * @return the array of capabilities
	 */
	private boolean[] toArray()
	{
		boolean cap[] = { this.maxPayload, this.arm, this.mobility, this.sensors, this.gripper};
		return cap;		
	}
	
	public String getState()
	{
		return this.state;
	}
	
	public void setState(String state)
	{
		this.state = state;
	}
	
	public void setMaxPayload(boolean val)
	{
		this.maxPayload = val;
	}
	
	public void setMobility(boolean val)
	{
		this.mobility = val;
	}
	
	public void setArm(boolean val)
	{
		this.arm = val;
	}
	
	public void setSensors(boolean val)
	{
		this.sensors = val;
	}
	
	public void setGripper(boolean val)
	{
		this.gripper = val;
	}
	
	

}
